home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / GAMES / P_ROBO31 / ABASIRI.PR next >
Text File  |  1993-02-28  |  3KB  |  79 lines

  1. (**************************************************************************)
  2. (*                             W A R N I N G                              *)
  3. (*                                                                        *)
  4. (*  This Robot has NOT been designed to take advantage of the advanced    *)
  5. (*  features of P-ROBOTS, such as, Shields, Fuel, Teams or Obstructions.  *)
  6. (**************************************************************************)
  7.  
  8.   PROCEDURE Abasiri;
  9.  
  10. {
  11.   Based on C-Robot by Hortense Endoh
  12. }
  13.  
  14.   VAR dir, deg, Range, spd : Integer;
  15.  
  16.     PROCEDURE shoot;
  17.     BEGIN
  18.       IF speed = 0 THEN {i.e., stopped -- probably ran into something}
  19.         BEGIN
  20.           dir := dir+90+Random(180); {go at random in opposite direction}
  21.           spd := MaxSpeed;
  22.         END;
  23.       drive(dir, spd);
  24.       Range := scan(deg, 10);
  25.       IF (Range > 40) THEN cannon(deg, Range)
  26.       ELSE BEGIN
  27.         deg := deg+20;
  28.         Range := scan(deg, 10);
  29.         IF Range = 0 THEN
  30.           BEGIN
  31.             deg := deg-40;
  32.             Range := scan(deg, 10);
  33.             IF Range = 0 THEN
  34.               BEGIN
  35.                 deg := deg+60;
  36.                 Range := scan(deg, 10);
  37.                 WHILE Range = 0 DO
  38.                   BEGIN
  39.                     deg := deg+20;
  40.                     Range := scan(deg, 10);
  41.                   END;
  42.               END;
  43.           END;
  44.         IF (Range > 40) AND (ObjectScanned = Enemy) THEN cannon(deg, Range);
  45.       END;
  46.     END;
  47.  
  48.     PROCEDURE init_proc;
  49.     BEGIN
  50.       dir := 270; spd := 100; WHILE (loc_y > 200) DO shoot;
  51.       dir := 90; shoot; shoot; shoot;
  52.       dir := 180; WHILE (loc_x > 600) DO shoot;
  53.       spd := 50; dir := 0; WHILE (loc_x < 750) DO shoot;
  54.       deg := 90;
  55.     END;
  56.  
  57.   BEGIN {Main Abasiri}
  58.  
  59.     init_proc;
  60.  
  61.     REPEAT
  62.       spd := 100; dir := 45; WHILE (loc_x < 800) DO shoot; dir := 225; shoot;
  63.       spd := 100; dir := 135; WHILE (loc_x > 750) DO shoot; dir := 315; shoot;
  64.       spd := 100; dir := 45; WHILE (loc_x < 800) DO shoot; dir := 225; shoot;
  65.       spd := 100; dir := 135; WHILE (loc_y < 800) DO shoot; dir := 315; shoot;
  66.       spd := 100; dir := 225; WHILE (loc_y > 750) DO shoot; dir := 45; shoot;
  67.       spd := 100; dir := 135; WHILE (loc_y < 800) DO shoot; dir := 315; shoot;
  68.       spd := 100; dir := 225; WHILE (loc_x > 200) DO shoot; dir := 45; shoot;
  69.       spd := 100; dir := 315; WHILE (loc_x < 250) DO shoot; dir := 135; shoot;
  70.       spd := 100; dir := 225; WHILE (loc_x > 200) DO shoot; dir := 45; shoot;
  71.       spd := 100; dir := 315; WHILE (loc_y > 200) DO shoot; dir := 135; shoot;
  72.       spd := 100; dir := 45; WHILE (loc_y < 250) DO shoot; dir := 225; shoot;
  73.       spd := 100; dir := 315; WHILE (loc_y > 200) DO shoot; dir := 135; shoot;
  74.  
  75.     UNTIL Dead OR Winner;
  76.  
  77.   END; { end of ABASIRI main }
  78.  
  79.